package org.bmind.datasword.exec.dto;

import org.bmind.datasword.utils.EqualsUtil;
import org.bmind.datasword.utils.HashCodeUtil;

public class DExecDataset {
	
	private int fHashCode=0;
	private int id =0;
	private String name = null;
	
	public DExecDataset() {	super();}

	public int getId() {return id;}
	public void setId(int id) {this.id = id;}

	public String getName() {return name;}
	public void setName(String name) {this.name = name;}
	
	

	/* (non-Javadoc)
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals(Object obj) {
	   
  	  if ( this == obj ) return true;
	    if ( !(obj instanceof DExecDataset) ) return false;
	    DExecDataset dEd = (DExecDataset)obj;
    	
    	return	EqualsUtil.areEqual(this.id, dEd.id) &&
    			EqualsUtil.areEqual(this.name, dEd.name);
    			
    }
   
	/* (non-Javadoc)
     * @see org.bmind.datasword.config.dto.DObjCommon#hashCode()
     */
	@Override
	public int hashCode() {
		
		// this style of lazy initialization is
		// suitable only if the object is immutable
		if (fHashCode == 0) {
		int result = HashCodeUtil.SEED;
			result = HashCodeUtil.hash(result, getId());
			result = HashCodeUtil.hash(result, getName());
			
			fHashCode = result;
		}
		return fHashCode;
	}

}
